<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<h:panelGrid columns="8" styleClass="normal">
	<h:outputText value="#{bundle.greige_start_plan}"/>
	<rich:calendar id="greigeStartPlan" value="#{con100.selectItem.greigeStartPlan}" datePattern="dd.MM.yyyy" locale="th_US" disabled="#{!con100.editGreige}">
		<a4j:support id="onchangeGreigeStartPlan" event="onchanged" reRender="greigeStartPlan" actionListener="#{con100.onchangeGreige}"/>
	</rich:calendar>
	<h:outputText value="#{bundle.greige_finish_plan}"/>
	<rich:calendar id="greigeFinishPlan" value="#{con100.selectItem.greigeFinishPlan}" datePattern="dd.MM.yyyy" locale="th_US" disabled="#{!con100.editGreige}">
		<a4j:support id="onchangeGreigeFinishPlan" event="onchanged" reRender="greigeFinishPlan" actionListener="#{con100.onchangeGreige}"/>
	</rich:calendar>
	<h:outputText value="#{bundle.machine}"/>
	<h:inputText id="greigeFinishMachine" value="#{con100.selectItem.greigeFinishMachine}" disabled="#{!con100.editGreige}">
		<a4j:support id="onchangeGreigeFinishMachine" event="onchange" reRender="greigeFinishMachine" actionListener="#{con100.onchangeGreige}"/>
	</h:inputText>
	<h:outputText value="#{bundle.remark}"/> 
	<h:inputTextarea id="greigeFinishRemark" value="#{con100.selectItem.greigeFinishRemark}" cols="20" rows="2" disabled="#{!con100.editGreige}">
		<a4j:support id="onchangeGreigeFinishRemark" event="onchange" reRender="greigeFinishRemark" actionListener="#{con100.onchangeGreige}"/>
	</h:inputTextarea>
	<h:outputText value="#{bundle.greige_start_actual}"/>
	<rich:calendar id="greigeStartActual" value="#{con100.selectItem.greigeStartActual}" datePattern="dd.MM.yyyy" locale="th_US" disabled="#{!con100.editGreige}">
		<a4j:support id="onchangeGreigeStartActual" event="onchanged" reRender="greigeStartActual" actionListener="#{con100.onchangeGreige}"/>
	</rich:calendar>
	<h:outputText value="#{bundle.greige_finish_actual}"/>
	<rich:calendar id="greigeFinishActual" value="#{con100.selectItem.greigeFinishActual}" datePattern="dd.MM.yyyy" locale="th_US" disabled="#{!con100.editGreige}">
		<a4j:support id="onchangeGreigeFinishActual" event="onchanged" reRender="greigeFinishActual" actionListener="#{con100.onchangeGreige}"/>
	</rich:calendar>
</h:panelGrid>
<a4j:commandButton id="insertGreigeLine" onclick="#{rich:component('insertReserveLineGreigePanel')}.show()" image="/images/addRow.png" actionListener="#{con100.insertReserveLineGreigeOpen}" disabled="#{!con100.editGreige}"/>
<rich:scrollableDataTable var="greigeItem" value="#{con100.greigeItems}" width="800px" height="110px" id="reserveItemGreigeTable" selection="#{con100.selectionGreige}">
	<rich:column sortable="false">
		<f:facet name="header">
			<h:outputText value="#{bundle.production_no}"></h:outputText>
		</f:facet>
		<h:outputText value="#{greigeItem.commonData.id.productionNo}"></h:outputText>
	</rich:column>
	<rich:column sortable="false">
		<f:facet name="header">
			<h:outputText value="#{bundle.material_greige}"></h:outputText>
		</f:facet>
		<h:outputText value="#{greigeItem.commonData.material}"></h:outputText>
	</rich:column>
	<rich:column sortable="false" styleClass="textRight">
		<f:facet name="header">
			<h:outputText value="#{bundle.qty_prod}"></h:outputText>
		</f:facet>
		<h:outputText value="#{greigeItem.commonData.quantity}">
			<f:convertNumber pattern="#,##0.00"/>
		</h:outputText>
	</rich:column>
	<rich:column sortable="false" width="40px">
		<f:facet name="header">
			<h:outputText value="#{bundle.uom}"></h:outputText>
		</f:facet>
		<h:outputText value="#{greigeItem.commonData.uom}"></h:outputText>
	</rich:column>
	<rich:column sortable="false">
		<f:facet name="header">
			<h:outputText value="#{bundle.prod_start_date}"></h:outputText>
		</f:facet>
		<h:outputText value="#{greigeItem.commonData.startDate}">
			<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
		</h:outputText>
	</rich:column>	
	<rich:column sortable="false">
		<f:facet name="header">
			<h:outputText value="#{bundle.last_posting_date}"></h:outputText>
		</f:facet>
		<h:outputText value="#{greigeItem.commonData.lastPostingDate}">
			<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
		</h:outputText>
	</rich:column>	
	<rich:column sortable="false">
		<f:facet name="header">
			<h:outputText value="#{bundle.remark}"></h:outputText>
		</f:facet>
		<h:outputText value="#{greigeItem.remark}"></h:outputText>
	</rich:column>
	<rich:column sortable="false" width="40px" styleClass="textCenter">
		<f:facet name="header">
			<h:outputText value="Actions"></h:outputText>
		</f:facet>
		<a4j:commandLink id="editLineGreigeLink" reRender="editReserveLineGreigePanel" oncomplete="#{rich:component('editReserveLineGreigePanel')}.show()" ajaxSingle="true">
			<h:graphicImage value="/images/icon_edit_item.gif" style="border:0" />
		</a4j:commandLink>
		<a4j:commandLink id="deleteLineGreigeLink" reRender="deleteReserveLineGreigePanel" oncomplete="#{rich:component('deleteReserveLineGreigePanel')}.show()" ajaxSingle="true">
			<h:graphicImage value="/images/delete.gif" style="border:0" />
		</a4j:commandLink>
	</rich:column>	
	<a4j:support id="take_reservelineGreige" event="onselectionchange" actionListener="#{con100.onchangeReserveLineGreige}"/>
</rich:scrollableDataTable>

